drop: stop accessing GdkDrag fields
authorMatthias Clasen <mclasen@redhat.com>
Sun, 15 Jul 2018 20:18:06 +0000 (16:18 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 15 Jul 2018 20:43:28 +0000 (16:43 -0400)
gdk/gdkdrop.c

index 03bc1e2485ac0d4f6219233e1a8aa614248145c9..f7f812a19eaf172e1db8db27b45e8ab4a2ad680a 100644 (file)
@@ -98,6 +98,7 @@ gdk_drop_read_local_async (GdkDrop             *self,
   GdkContentFormats *content_formats;
   const char *mime_type;
   GTask *task;
+  GdkContentProvider *content;
 
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_priority (task, io_priority);
@@ -111,7 +112,9 @@ gdk_drop_read_local_async (GdkDrop             *self,
       return;
     }
 
-  content_formats = gdk_content_provider_ref_formats (priv->drag->content);
+  g_object_get (priv->drag, "content", &content, NULL);
+  content_formats = gdk_content_provider_ref_formats (content);
+  g_object_unref (content); 
   content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
   mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
 
@@ -724,8 +727,16 @@ gdk_drop_read_value_internal (GdkDrop             *self,
   if (priv->drag)
     {
       GError *error = NULL;
+      GdkContentProvider *content;
+      gboolean res;
 
-      if (gdk_content_provider_get_value (priv->drag->content, value, &error))
+      g_object_get (priv->drag, "content", &content, NULL);
+
+      res = gdk_content_provider_get_value (content, value, &error);
+
+      g_object_unref (content);
+
+      if (res)
         {
           g_task_return_pointer (task, value, NULL);
           g_object_unref (task);